package com.wonders.frame.repository;

import com.wonders.frame.entity.AuthAccount;
import com.wonders.frame.entity.AuthUser;
import com.wonders.frame.repository.core.CoreRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AuthAccountRepository extends CoreRepository<AuthAccount> {


    @Query("select d from AuthAccount d where removed = 0 and deptId=:deptId")
    List<AuthAccount> getAccountByOrga(@Param("deptId") String deptId);


    AuthAccount findByUserAndRemoved(AuthUser userId, Integer removed);

    List<AuthAccount> findByAccountAndRemoved(String account, Integer removed);

    List<AuthAccount> findByOrgaIdAndRemoved(String orgaId, Integer removed);

    List<AuthAccount> findByDeptIdAndRemoved(String deptId, Integer removed);

    AuthAccount findAllById(String accountId);
}
